/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package videostoreapp;

import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.logging.Level;
import java.util.logging.Logger;
import videostoreapp.dataobjects.OrderDO;

/**
 *
 * @author oiiv2253
 */
public class OrderListener {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws Exception {

        System.out.println("Trying to fetch the messages");

            OrderMgr.getInstance().startQueueListener();

            Reader inputStreamReader = new InputStreamReader(System.in);

            char answer = 0;
            while (!((answer == 'q') || (answer == 'Q'))) {
                try {
                    answer = (char) inputStreamReader.read();
                } catch (IOException e) {
                    System.err.println("I/O exception: " + e.toString());
                }
            }
            OrderMgr.getInstance().stopQueueListener();

        System.exit(0);

    }
}